//----------------------------------------------------------
// Timer.h
//   Timer class definition for HUD displays or background
//      management, can run ascending / descending
//----------------------------------------------------------

#ifndef _TIMER_H_
#define _TIMER_H_

class Timer 
{
private:
	float _timeToCount;	// core time in milliseconds
	float _incrTime;	// time to increment
	bool _countdown;	// is the timer a countdown?
	bool _timerOn;		// timer currently running

	int _timeMin;		// minute portion of _incrTime
	int _timeSec;		// second portion of _incrTime

public:
	Timer();
	~Timer();

	// housekeeping
	bool Initialize(float timeToCount, bool countdown);	// sets values
	bool Update(float deltaTime);						// updates time based on frame time

	// timer controls
	void Start() { _timerOn = true; }			// use to drive timer updates
	void Stop() { _timerOn = false; }			// use to stop timer updates
	bool isRunning() { return _timerOn; }		// is the timer running?

	// time management
	void ConvertTime(float incrTime);			// converts float ms to int min/sec
	int Min() { return _timeMin; }				// min portion of time
	int Sec() { return _timeSec; }				// sec portion of time
	float CurrentTime() { return _incrTime; }	// current ms of time
	float CoreTime() { return _timeToCount; }	// initial time value
};

#endif